package com.hnhp.controller;

import com.hnhp.dto.ResponseDto;
import com.hnhp.model.CarVideo;
import com.hnhp.model.CarVideoQuery;
import com.hnhp.service.CarVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
@CrossOrigin
public class CarVideoController {
    //引入 数据逻辑类
    @Autowired
    private CarVideoService service;

    @GetMapping("/select")
    public List<CarVideo> select(CarVideoQuery query){
//        if(1==1){
//            throw new RuntimeException("123");
//        }
        return service.select(query);
    }


//    @GetMapping("/select")
//    public ResponseDto select(CarVideoQuery query){
//        List<CarVideo> carVideos = service.select(query);
//        return ResponseDto.success(carVideos);
//    }

}
